const state = {
	tabList:[],
  waitServeList:[],
  doneServeList:[],
  currentMainServe:{
    "mtId": "",
    "mtName": "",
    "mtContent": "",
    "taskTypeId": "",
    "creator": "",
    "createtime": "",
    "updatetime": "",
    "states": "",
    "etId": ""
},
  currentMainServeCount:[],
  currentMainServeCountJson:{
    total:0,
    mine:0,
    others:0
  },
  currentSubServeInfo:{
    "stId": "",
    "mtId": "",
    "stName": "",
    "stContent": "",
    "stState": "",
    "girdId": "",
    "parkId": "",
    "stType": "",
    "stPerson": "",
    "stBack": null,
    "stBackTime": "",
    "stFinishContent": "",
    "stFinishTime": "",
    "stFinishPic": null,
    "creator": "",
    "createtime": "",
    "updatetime": "",
    "states": ""
  },
  otherSubTaskList:[],
  ownerSubTaskList:[],
  updateServeItem:{
    "stId": "",
    "mtId": "",
    "stName": "",
    "stContent": "",
    "stState": "",
    "girdId": "",
    "parkId": "",
    "stType": "",
    "stPerson": "",
    "stBack": null,
    "stBackTime": "",
    "stFinishContent": "",
    "stFinishTime": "",
    "stFinishPic": null,
    "creator": "",
    "createtime": "",
    "updatetime": "",
    "states": ""
  }
}

const mutations = {
	setTabList(state,list){
    state.tabList = list.map(item=>({
      ...item,
      name:item.finishType==="1"?"待执行":"已执行"
    }))
  },
  setWaitServeList(state,payload){
    if(payload.type==="initial"){
      state.waitServeList = payload.data
    }else{
      state.waitServeList = [
        ...state.waitServeList,
        ...payload.data
      ]
    }
  },
  setDoneServeList(state,payload){
    if(payload.type==="initial"){
      state.doneServeList = payload.data
    }else{
      state.doneServeList = [
        ...state.doneServeList,
        ...payload.data
      ]
    }
  },
  setCurrentMainServe(state,data){
    state.currentMainServe = data
  },
  setCurrentMainServeCount(state,list){
    state.currentMainServeCount = list
  },
  setCurrentMainServeCountJson(state,data){
    state.currentMainServeCountJson = data
  },
  setCurrentSubServeInfo(state,data){
    state.currentSubServeInfo = data
  },
  clearCurrentSubServeInfo(state){
    state.currentSubServeInfo = {
      "stId": "",
      "mtId": "",
      "stName": "",
      "stContent": "",
      "stState": "",
      "girdId": "",
      "parkId": "",
      "stType": "",
      "stPerson": "",
      "stBack": null,
      "stBackTime": "",
      "stFinishContent": "",
      "stFinishTime": "",
      "stFinishPic": null,
      "creator": "",
      "createtime": "",
      "updatetime": "",
      "states": ""
    }
  },
  setOtherSubTaskList(state,list){
    state.otherSubTaskList = list
  },
  setOwnerSubTaskList(state,list){
    state.ownerSubTaskList = list
  },
  setUpdateServeItem(state,data){
    state.updateServeItem = data
  }
}

const actions = {

}

const getters = {

}

export default {
	namespaced: true,
	state,
	mutations,
	actions,
	getters
}